<?php 
class user_register 
{ 
	function register_in() 
	{ 
		global $mysql_conn,$v_file;
		$sql = "SELECT * from `web` WHERE `web_isset` = '1';";
		$result = mysql_query($sql,$mysql_conn);
		@$row=mysql_fetch_array($result);
		$web_id = $row['web_id'];
		$web_bot = $row['web_bot'];
		$web_name = $row['web_name'];
		$web_url = $row['web_url'];
		$web_title = $row['web_title'];
		$web_keywords = $row['web_keywords'];
		$web_description = $row['web_description'];
		$web_company = $row['web_company'];
		$web_copyright = $row['web_copyright'];
		$web_isset = $row['web_isset'];
		require($v_file);
	}
	function register_do() 
	{ 
		global $mysql_conn;
		$user_name = $_POST['user_name'];
		$user_password = $_POST['user_password'];
		$a = date("Y-m-d",time());
		$b = date('Y-m-d',strtotime('+12 Month',strtotime($a)));
		$user_type_time_end = $b;
		$sql = "SELECT * from `web` WHERE `web_isset` = '1' ";
		$result = mysql_query($sql,$mysql_conn);
		@$row = mysql_fetch_array($result);
		$web_usertype = $row['web_usertype'];		
		$sql = "SELECT * from `user` WHERE `user_name` = '".$user_name."'";
		$result = mysql_query($sql,$mysql_conn);
		@$row = mysql_fetch_array($result);
		if (empty($row)) {
			$sql = "SELECT * from `user_type` WHERE `type_id` = '".$web_usertype."' ";
			$result = mysql_query($sql,$mysql_conn);
			@$row = mysql_fetch_array($result);
			$type_bot_num = $row['type_bot_num'];
			$sql="INSERT INTO user (user_id, user_name, user_password, user_type, user_bot_num, user_type_time_end, user_glod) VALUES (NULL,'$user_name','$user_password','$web_usertype','$type_bot_num','$user_type_time_end','0')";
			$result = mysql_query($sql,$mysql_conn);
			@$row = mysql_fetch_array($result);
			$sql = "SELECT * from `user` WHERE `user_name` = '".$user_name."'";
			$result = mysql_query($sql,$mysql_conn);
			@$row = mysql_fetch_array($result);
			$user_id = $row['user_id'];
			$sql="INSERT INTO user_info (info_id) VALUES ($user_id)";
			$result = mysql_query($sql,$mysql_conn);
			@$row = mysql_fetch_array($result);
			echo "2";//用户注册成功
		} else {
			echo  "1";//用户已存在
		}
	}
} 
/* End of file democontroller.php */ 